package com.itheima.set;

import java.util.TreeSet;

/*
TreeSet常用方法
 */
public class Demo04 {


    public static void main(String[] args) {
        TreeSet<String> set = new TreeSet<>();
        set.add("abc");
        set.add("bcd");
        set.add("cde");
        set.add("def");
        set.add("eee");
        set.add("JQK");
        System.out.println(set);

        String first = set.first();
        System.out.println(first);
        String last = set.last();
        System.out.println(last);
        String floor = set.floor("eee");
        System.out.println(floor);
        String eee = set.lower("eee");
        System.out.println(eee);

        for (String s : set) {

            System.out.println(s);
        }

        set.forEach(s -> System.out.println(s));
    }
}
